summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Items/ItemMobHead.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/Items/ItemMobHead.h b/src/Items/ItemMobHead.h
index d962dabae..ac905275a 100644
--- a/src/Items/ItemMobHead.h
+++ b/src/Items/ItemMobHead.h
@@ -53,7 +53,7 @@ public:
)
{
// Place the block:
- if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_HEAD, static_cast<NIBBLETYPE>(a_EquippedItem.m_ItemType)))
+ if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_HEAD, BlockFaceToBlockMeta(a_BlockFace)))
{
return false;
}
@@ -92,7 +92,7 @@ public:
m_BlockMeta(a_BlockMeta)
{}
};
- cCallback Callback(a_Player, static_cast<eMobHeadType>(a_EquippedItem.m_ItemType), static_cast<NIBBLETYPE>(a_BlockFace));
+ cCallback Callback(a_Player, static_cast<eMobHeadType>(a_EquippedItem.m_ItemDamage), static_cast<NIBBLETYPE>(a_BlockFace));
a_World.DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, Callback);
return true;
}
@@ -279,6 +279,26 @@ public:
}
+ /** Converts the block face of the placement (which face of the block was clicked to place the head)
+ into the block's metadata value. */
+ static NIBBLETYPE BlockFaceToBlockMeta(int a_BlockFace)
+ {
+ switch (a_BlockFace)
+ {
+ case BLOCK_FACE_TOP: return 0x01; // On ground (rotation provided in block entity)
+ case BLOCK_FACE_XM: return 0x04; // west wall, facing east
+ case BLOCK_FACE_XP: return 0x05; // east wall, facing west
+ case BLOCK_FACE_ZM: return 0x02; // north wall, facing south
+ case BLOCK_FACE_ZP: return 0x03; // south wall, facing north
+ default:
+ {
+ ASSERT(!"Unhandled block face");
+ return 0;
+ }
+ }
+ }
+
+
virtual bool IsPlaceable(void) override
{
return true;